<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

/**
 * Description of Inputvalidation
 *
 * @author virtual
 */
class Inputvalidation {
    
    private static $usernamePattern = "/^[a-z][A-Z][0-9]_-$/";
    private static $passwordPattern = "/^[a-z][A-Z][0-9]_-!?$/";
    
    
    public static function validate($value, $pattern){
        
        $matches = preg_match($pattern, $value);
    	return (sizeof($matches) == 1);
    }
    
    public static function isValidUsername($username){
        return self::validate($username, self::$usernamePattern);
    }
    
    public static function isValidPassword($password){
        return self::validate($password, self::$passwordPattern);
    }
}

?>
